package cn.appsys.config;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.servlet.http.HttpServletRequest;

@ControllerAdvice
public class MyAdvice {
    @ExceptionHandler
    public String handlerException(Exception e, HttpServletRequest request)     {
        request.setAttribute("msg", "异常：" + e.getMessage());
        return "error";
    }
    /* @InitBinder  //使用配置转换器方式
 public void web(WebDataBinder binder) {
     binder.registerCustomEditor(Date.class,
             new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
 }*/
}
